package com.kma.summer2012.client.events.manager;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.kma.summer2012.shared.model.UICrumbsWorkItem;

/**
 * Created with IntelliJ IDEA.
 * User: Администратор
 * Date: 12.02.13
 * Time: 21:41
 * To change this template use File | Settings | File Templates.
 */
public class AddWorkEvent extends GwtEvent<AddWorkEvent.AddWorkEventHandler> {
    private final UICrumbsWorkItem uiWork;

    public UICrumbsWorkItem getUiWork() {
        return this.uiWork;
    }


    public static Type<AddWorkEventHandler> getType() {
        return TYPE;
    }
 /*
    public interface AddWorkEventHandler extends EventHandler {
        void OnAddWork(AddWorkEvent event, UICrumbsWorkItem uiWork);
    }
    */

    public interface AddWorkEventHandler extends EventHandler {
        void OnAddWork(AddWorkEvent event);
    }

    private static Type<AddWorkEventHandler> TYPE = new Type<AddWorkEventHandler>();

    public AddWorkEvent(UICrumbsWorkItem uiWork) {
        this.uiWork = uiWork;
    }

    @Override
    public Type<AddWorkEventHandler> getAssociatedType() {
        return TYPE;
    }

    public Type<AddWorkEventHandler> getTYPE() {
        return TYPE;
    }

    @Override
    protected void dispatch(AddWorkEventHandler addWorkEventHandler) {
        addWorkEventHandler.OnAddWork(this);
    }

}
